﻿

Thread thread = new Thread((n) =>
{
    Console.WriteLine($"线程参数:{n}");

	try
	{
		for (int i = 0; i <= 20; i++)
		{
            Console.WriteLine($"执行到第{i}个");
			Thread.Sleep(100);
		}
	}
	catch(ThreadInterruptedException)
	{

	}
	finally
	{
        Console.WriteLine("线程执行完毕...");
	}
});

Console.WriteLine("主线程开始执行.....");

thread.Start(6);
Thread.Sleep(1000);
thread.Interrupt();
thread.Join();

Console.WriteLine("主线程执行完毕!");